package androidx.blogger;

import androidx.gdata.blogger.BlogEntry;
import androidx.gdata.blogger.BlogEntryCollection;
import androidx.list.AbstractListModel;

public class BlogEntryCollectionListModel extends AbstractListModel<BlogEntry> {
	private BlogEntryCollection entries;
	
	public int getCount() {
		if (entries == null) {
			return 0;
		}
		BlogEntry[] posts = entries.getBlogEntries();
		return (posts == null) ? 0 : posts.length;
	}

	public BlogEntry getItem(int position) {
		if (entries == null) {
			return null;
		}
		BlogEntry[] posts = entries.getBlogEntries();
		return (posts == null) ? null : posts[position];
	}

	public void setBlogEntryCollection(BlogEntryCollection entries) {
		this.entries = entries;
		this.fireListModelChanged();
	}
}
